package com.ler.demo.controller;

import com.ler.demo.config.HttpResult;
import com.ler.demo.entity.UserAccount;
import com.ler.demo.mapper.UserAccountMapper;
import com.ler.demo.service.UserAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户相关 前端控制器
 * </p>
 *
 * @author lww
 * @since 2021-03-11
 */
@Slf4j
@RestController
@RequestMapping("/user")
@Api(value = "/user", description = "用户")
public class UserAccountController {

    @Resource
    private UserAccountService userAccountService;

    @Resource
    private UserAccountMapper userAccountMapper;

    @ApiOperation("查询一个")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "", value = "", required = true),
    })
    @GetMapping(value = "/one", name = "查询一个")
    public HttpResult one() {
        //service
        UserAccount account = userAccountService.getById(1L);
        //mapper
        // UserAccount account = userAccountMapper.selectById(1L);
        //AR模式
        // UserAccount account = new UserAccount();
        // account.setId(1L);
        // account = account.selectById();
        return HttpResult.success(account);
    }
}
